<!--begin.rcode results='hide', echo=FALSE, message=FALSE
library(caret)
hook_inline = knit_hooks$get('inline')
knit_hooks$set(inline = function(x) {
  if (is.character(x)) highr::hi_html(x) else hook_inline(x)
  })
opts_chunk$set(comment=NA)

session <- paste(format(Sys.time(), "%a %b %d %Y"),
                 "using caret version",
                 packageDescription("caret")$Version,
                 "and",
                 R.Version()$version.string)
printModelInfo <- function(x) {
  txt <- paste("<h1>", x$label, "</h1>\n",
               "<p><tt><span class=\"mx arg\">method</span> = <span class=\"mx str\">'", 
               x$method_value, "'</span></tt></p>\n",
               "<p><b>Type</b>: ", paste(x$type, collapse = ", "), "</p>\n",
               sep = "")
  if(all(x$parameters$parameter == "parameter")) {
    txt <- paste(txt, "<p>No Tuning Parameters</p>\n", sep = "")
    } else {
      prm <- paste("<code><span class=\"mx arg\">", x$parameters$parameter, "</span></code> (", x$parameters$label, ")", sep = "")
      txt <- paste(txt, 
                   paste("<p><b>Tuning Parameters</b>: ", 
                         paste(prm, collapse = ", "), "</p>\n", sep = ""), sep = "")
      }
  txt
  }

    end.rcode-->
    
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  <!--
  Design by Free CSS Templates
http://www.freecsstemplates.org
Released for free under a Creative Commons Attribution 2.5 License

Name       : Emerald 
Description: A two-column, fixed-width design with dark color scheme.
Version    : 1.0
Released   : 20120902

-->
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Models Available in train By Tag</title>
  <link href='http://fonts.googleapis.com/css?family=Abel' rel='stylesheet' type='text/css'>
  <link href="style.css" rel="stylesheet" type="text/css" media="screen" />
  </head>
  <body>
  <div id="wrapper">
  <div id="header-wrapper" class="container">
  <div id="header" class="container">
  <div id="logo">
  <h1><a href="#">Models Available in train By Tag</a></h1>
</div>
  <!--
  <div id="menu">
  <ul>
  <li class="current_page_item"><a href="#">Homepage</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Photos</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
  </div>
  -->
  </div>
  <div><img src="images/img03.png" width="1000" height="40" alt="" /></div>
  </div>
  <!-- end #header -->
<div id="page">
  <div id="content">
  
<p>
The following is a basic list of model types or relevant
characteristics. There entires in these lists are arguable. For
example: random forests theoretically use feature selection but
effectively may not, support vector machines use L2 regularization
etc. 
</p>
  
<!--begin.rcode tags, results='asis', echo=FALSE, message=FALSE
mods <- getModelInfo()

## redundant tag names (e.g. "L1 Regularization Models" and "L1 Regularization")
## these will get changed in the files but make a short fix for now

fix_tags <- function(x) {
  x[x == "L1 Regularization Models"] <- "L1 Regularization"
  x[x == "L2 Regularization Models"] <- "L2 Regularization"
  x[x == "Generalized Linear Models"] <- "Generalized Linear Model"
  x[x == "Discriminant Analysis Models"] <- "Discriminant Analysis"
  x[x == "Feature Extraction Models"] <- "Feature Extraction"  
  x[x == "Linear Classifier Models"] <- "Linear Classifier"    
  x[x == "Linear Regression Models"] <- "Linear Regression"     
  x
  }


for(j in seq(along = mods)) mods[[j]]$method_value <- names(mods)[j]

tags  <- lapply(mods, function(x) x$tag)
tags <- lapply(tags, fix_tags)
utags <- sort(unique(unlist(tags)))
utags <- utags[utags != ""]
fname <- paste(gsub("([[:punct:]])|([[:space:]])", "_", utags),
               ".html", sep = "")
ftitle <- utags
nomod <- !grepl("(method)|(model)|(machine)|(maps)", tolower(utags))
ftitle[nomod] <- paste(ftitle[nomod], " Models", sep = "")

temp <- read.delim("template.html", sep = "\n",
                   blank.lines.skip = FALSE,
                   stringsAsFactors = FALSE,
                   quote = "")[,1]
temp <- paste(temp, collapse = "\n")

for(j in seq(along = utags)) {
  hasit <- unlist(lapply(mods, function(x) any(x$tag == utags[j])))
  subs <- mods[hasit]
  subs <- subs[order(unlist(lapply(subs, function(x) x$label)))]
  temp_temp <- temp
  temp_temp <- gsub("TITLETITLE", ftitle[j], temp_temp)
  tt <- lapply(subs, printModelInfo)
  tt <- paste(tt, collapse = "\n", sep = "")
  temp_temp <- gsub("CONTENTCONTENT", tt, temp_temp) 
  temp_temp <- gsub("FOOTERFOOTER", session, temp_temp) 
  cat(temp_temp, file = fname[j])
  rm(tt, temp_temp, subs, hasit)
}

refs <- paste('<a href="', fname, '">', ftitle, '</a>', sep = "")
refs <- paste('     <li>', refs, '</li>')
refs <- paste(refs, collapse = "\n", sep = "")
refs <- paste('  <ul>', refs, '  </ul>', sep = "\n")
cat(refs)
    end.rcode-->
    
<!--begin.rcode table, results='hide', echo=FALSE, message=FALSE
mods <- getModelInfo()

reformat <- function(x) {
  if(all(as.character(x$parameters$parameter) == "parameter")) {
    pList <- "None"
  } else {
    pList <- paste(as.character(x$parameters$parameter), 
          collapse = ", ", sep = "")
  }
  data.frame(Model = x$label,
             Method = "",
             Type = paste(sort(x$type), collapse = ", ", sep = ""),
             Packages = paste(x$library, collapse = ", ", sep = ""),
             Param = pList,
             stringsAsFactors = FALSE)
}

modelTable <- lapply(mods, reformat)
modelTable <- rbind.fill(modelTable)
modelTable$Type[grepl(",", modelTable$Type)] <- "Dual Use"
modelTable$Method <- names(mods)
colnames(modelTable)[2] <- "method Argument Value"
colnames(modelTable)[5] <- "Tuning Parameters"
print(gvisTable(modelTable, options = list(width = "800px")),
      file = "modelList.html")    
    end.rcode-->    
<div style="clear: both;">&nbsp;</div>
  </div>
  <!-- end #content -->
<div id="sidebar">
<ul>
  <li>
    <h2>General Topics</h2>
    <ul>
      <li><a href="index.html">Front Page</a></li>
      <li><a href="visualizations.html">Visualizations</a></li>
      <li><a href="preprocess.html">Pre-Processing</a><li>
      <li><a href="splitting.html">Data Splitting</a></li>
      <li><a href="varimp.html">Variable Importance</a></li>
      <li><a href="other.html">Model Performance</a></li>
      <li><a href="parallel.html">Parallel Processing</a></li>
    </ul>
    <h2>Model Training and Tuning</h2>
    <ul>
      <li><a href="training.html">Basic Syntax</a></li>
      <li><a href="modelList.html">Sortable Model List</a></li>
      <li><a href="bytag.html">Models By Tag</a></li>
      <li><a href="similarity.html">Models By Similarity</a></li>
      <li><a href="custom_models.html">Using Custom Models</a></li>
      <li><a href="sampling.html">Sampling for Class Imbalances</a></li> 
      <li><a href="random.html">Random Search</a></li> 
      <li><a href="adaptive.html">Adaptive Resampling</a></li> 
    </ul>
    <h2>Feature Selection</h2>
    <ul>
      <li><a href="featureselection.html">Overview</a>
      <li><a href="rfe.html">RFE</a></li>
      <li><a href="filters.html">Filters</a></li>
      <li><a href="GA.html">GA</a></li>
      <li><a href="SA.html">SA</a></li>
    </ul>  
  </li>
</ul>
</div>
<!-- end #sidebar -->
<div style="clear: both;">&nbsp;</div>
  </div>
  <div class="container"><img src="images/img03.png" width="1000" height="40" alt="" /></div>
  <!-- end #page -->
</div>
  <div id="footer-content"></div>
  <div id="footer">
  <p>Created on <!--rinline I(session) -->.</p>
  </div>
  <!-- end #footer -->
</body>
  </html>
